<?php
	include_once '../config.inc.php';
	if($adminId <= 0){
		echo '<script type="text/javascript">location.href = \'login.php\';</script>';
		die(0);
	}
	$stmt = $pdo->prepare('select gid,isbn,gname,gphoto,gclass,inprice,price,zkprice,num,bz from kp_goods where gzt = 0');
	$stmt->execute();
	$goodsArr = $stmt->fetchAll(PDO::FETCH_ASSOC);
	//print_r($goodsArr);
?>
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<script src="../js/jquery-3.1.1.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/editgood.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" type="text/css" href="css/editgood.css"/>
	<title>已有商品管理</title>
</head>
<body>
	<div id="editgood">
		<div class="title">
			后台管理->商品管理
		</div>
		<ul class="goodtitle">
			<li class="c0">序号</li>
			<li class="c1">isbn</li>
			<li class="c2">商品名称</li>
			<li class="c3">商品主图</li>
			<li class="c4">商品分类</li>
			<li class="c5">进价</li>
			<li class="c6">零售价</li>
			<li class="c7">活动价</li>
			<li class="c8">说明</li>
			<li class="c9">操作</li>
			
		</ul>
		<div id="goodsdiv">
			<?php
				foreach($goodsArr as $good){ 
			?>
			<ul class="good">
				<li class="c0"><?php echo $good['gid']; ?></li>
				<li class="c1" contenteditable="true"><?php echo $good['isbn']; ?></li>
				<li class="c2" contenteditable="true"><?php echo $good['gname']; ?></li>
				<li class="c3" contenteditable="true"><?php echo $good['gphoto']; ?></li>
				<li class="c4" contenteditable="true"><?php echo $good['gclass']; ?></li>
				<li class="c5" contenteditable="true"><?php echo $good['inprice']; ?></li>
				<li class="c6" contenteditable="true"><?php echo $good['price']; ?></li>
				<li class="c7" contenteditable="true"><?php echo $good['zkprice']; ?></li>
				<li class="c8" contenteditable="true"><?php echo $good['bz']; ?></li>
				<!--<li class="c9"><span class="goedit">[改]</span> <span class="godel">[删]</span></li>-->
				<li class="goedit">[改]</li>
				<li class="godel">[删]</li>
			</ul>
			<?php } ?>
		</div>
		
		<!--调试AJAX输出错误用
			<pre id="request" style="width: 100%; float: left; height: auto;">
			
		</pre>-->
		
		
	</div>
</body>
</html>